<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>行内元素和行内块级元素水平居中</title>
  <style>
    /* 行内元素或者行内块级元素水平居中给其父元素添加 text-align:center 既可 */

    .header {
      width: 900px;
      height: 300px;
      background-color: pink;
      margin: 100px auto;
      text-align: center;
    }
  </style>
</head>
<body>
  <div class="header">
    <span>这是一些内容</span>
  </div>
  <div class="header">
    <img src="images/down.jpg" />
  </div>
</body>
</html>